﻿using System;
using System.Runtime.Serialization;

namespace IGM.DataProvider
{
    public partial class Major
    {
        public bool IsChecked { get; set; }

        private dynamic _properties;
        [IgnoreDataMember]
        public dynamic Properties
        {
            get
            {
                _properties = _properties ?? this.GetProperties();
                return _properties;
            }
        }
    }

    public partial class KindIntern
    {
        public bool IsChecked { get; set; }

        private dynamic _properties;
        [IgnoreDataMember]
        public dynamic Properties
        {
            get
            {
                _properties = _properties ?? this.GetProperties();
                return _properties;
            }
        }
    }

    public partial class KindMark
    {
        public bool IsChecked { get; set; }

        private dynamic _properties;
        [IgnoreDataMember]
        public dynamic Properties
        {
            get
            {
                _properties = _properties ?? this.GetProperties();
                return _properties;
            }
        }
    }

    public partial class Student
    {
        public bool IsChecked { get; set; }

        public string MajorName
        {
            get { return Major != null ? Major.Name : string.Empty; }
        }

        private dynamic _properties;
        [IgnoreDataMember]
        public dynamic Properties
        {
            get
            {
                _properties = _properties ?? this.GetProperties();
                return _properties;
            }
        }
    }

    public partial class User
    {
        public string PermissionName { get
        {
            string per = "Khách";
            switch (Permission)
            {
                case 0:
                    per = "Admin";
                    break;
                case 1:
                    per = "Trưởng khoa";
                    break;
                case 2:
                    per = "Trợ lý đào tạo";
                    break;
            }
//Admin
//Trưởng khoa
//Trợ lý đào tạo
//Khách
            return per;
        } }

        public bool IsChecked { get; set; }

        private dynamic _properties;
        [IgnoreDataMember]
        public dynamic Properties
        {
            get
            {
                _properties = _properties ?? this.GetProperties();
                return _properties;
            }
        }
    }

    public partial class StudentMark
    {
        public bool IsChecked { get; set; }

        public int Index { get; set; }

        public string KindMarkName
        {
            get { return KindMark != null ? KindMark.Name : string.Empty; }
        }

        public string StudentCode
        {
            get { return Student != null ? Student.Code : string.Empty; }
        }

        public string StudentName
        {
            get { return Student != null ? Student.Name : string.Empty; }
        }

        private dynamic _properties;
        [IgnoreDataMember]
        public dynamic Properties
        {
            get
            {
                _properties = _properties ?? this.GetProperties();
                return _properties;
            }
        }
    }

    public partial class Lecturer
    {
        public bool IsChecked { get; set; }

        public string MajorName
        {
            get { return Major != null ? Major.Name : string.Empty; }
        }

        private dynamic _properties;
        [IgnoreDataMember]
        public dynamic Properties
        {
            get
            {
                _properties = _properties ?? this.GetProperties();
                return _properties;
            }
        }
    }

    public partial class Group
    {
        public bool IsChecked { get; set; } 

        private dynamic _properties;
        [IgnoreDataMember]
        public dynamic Properties
        {
            get
            {
                _properties = _properties ?? this.GetProperties();
                return _properties;
            }
        }
    }

    public partial class GroupStudent
    {
        public bool IsChecked { get; set; }

        public string StudentName
        {
            get { return Student != null ? Student.Name : string.Empty; }
        }

        public string StudentCode
        {
            get { return Student != null ? Student.Code : string.Empty; }
        }

        private dynamic _properties;
        [IgnoreDataMember]
        public dynamic Properties
        {
            get
            {
                _properties = _properties ?? this.GetProperties();
                return _properties;
            }
        }
    }

    public partial class StudentGraduation
    {
        public bool IsChecked { get; set; }

        public string Name
        {
            get { return Student != null ? Student.Name : string.Empty; }
        }

        public string Code
        {
            get { return Student != null ? Student.Code : string.Empty; }
        }

        public DateTime DateOfBirth
        {
            get
            {
                if (Student.DateOfBirth != null) return (DateTime) Student.DateOfBirth;
                return new DateTime();
            }
        }

        private dynamic _properties;
        [IgnoreDataMember]
        public dynamic Properties
        {
            get
            {
                _properties = _properties ?? this.GetProperties();
                return _properties;
            }
        }
    }

    public partial class GroupLecturer
    {
        public bool IsChecked { get; set; }

        public string GroupName
        {
            get { return Group != null ? Group.Name : string.Empty; }
        }    

        public string LecturerName
        {
            get { return Lecturer != null ? Lecturer.Name : string.Empty; }
        }

        private dynamic _properties;
        [IgnoreDataMember]
        public dynamic Properties
        {
            get
            {
                _properties = _properties ?? this.GetProperties();
                return _properties;
            }
        }
    }

    public partial class StudentLecturer
    {
        public bool IsChecked { get; set; }

        public string StudentName
        {
            get { return StudentGraduation != null ? StudentGraduation.Student.Name : string.Empty; }
        }

        public string StudentCode
        {
            get { return StudentGraduation != null ? StudentGraduation.Student.Code : string.Empty; }
        }

        public string LecturerName
        {
            get { return Lecturer != null ? Lecturer.Name : string.Empty; }
        }      
        private dynamic _properties;
        [IgnoreDataMember]
        public dynamic Properties
        {
            get
            {
                _properties = _properties ?? this.GetProperties();
                return _properties;
            }
        }
    }

    public partial class Subcommittee
    {
        public bool IsChecked { get; set; }

        private dynamic _properties;
        [IgnoreDataMember]
        public dynamic Properties
        {
            get
            {
                _properties = _properties ?? this.GetProperties();
                return _properties;
            }
        }
    }

    public partial class SubcommitteeGroup
    {
        public bool IsChecked { get; set; }

        public string GroupName
        {
            get { return Group != null ? Group.Name : string.Empty; }
        }

        public string SubcommitteeName
        {
            get { return Subcommittee != null ? Subcommittee.Name : string.Empty; }
        }

        private dynamic _properties;
        [IgnoreDataMember]
        public dynamic Properties
        {
            get
            {
                _properties = _properties ?? this.GetProperties();
                return _properties;
            }
        }
    }

    public partial class SubcommitteeLecturer
    {
        public bool IsChecked { get; set; }

        public string LecturerName
        {
            get { return Lecturer != null ? Lecturer.Name : string.Empty; }
        }

        public string SubcommitteeName
        {
            get { return Subcommittee != null ? Subcommittee.Name : string.Empty; }
        } 

        private dynamic _properties;
        [IgnoreDataMember]
        public dynamic Properties
        {
            get
            {
                _properties = _properties ?? this.GetProperties();
                return _properties;
            }
        }
    }

    public partial class SubcommitteeStudent
    {
        public bool IsChecked { get; set; }

        public string StudentName
        {
            get { return StudentGraduation != null ? StudentGraduation.Name : string.Empty; }
        }

        public string StudentCode
        {
            get { return StudentGraduation != null ? StudentGraduation.Code : string.Empty; }
        }

        public string SubcommitteeName
        {
            get { return Subcommittee != null ? Subcommittee.Name : string.Empty; }
        } 

        private dynamic _properties;
        [IgnoreDataMember]
        public dynamic Properties
        {
            get
            {
                _properties = _properties ?? this.GetProperties();
                return _properties;
            }
        }
    }
}
